const state = {
    leftOptions: {
        showBack: true,
    },
    selectedTab: '',
    demoScrollTop: 0,
    isLoading: false,
    data: '',
    direction: 'forward'
}


const getters = {
    leftOptions: state => state.leftOptions,
    selectedTab: state => state.selectedTab
}


const actions = {
    updateDemoPosition({ commit }, top) {
        commit({ type: 'updateDemoPosition', top: top })
    },
    updateData({ commit }, data) {
        commit({ type: 'updateData', data: data })
    }
}

const mutations = {
    showBack(state, result) {
        state.leftOptions.showBack = result
    },
    selectedTab(state, tab) {
        state.selectedTab = tab
    },
    updateDemoPosition(state, payload) {
        state.demoScrollTop = payload.top
    },
    updateLoadingStatus(state, payload) {
        state.isLoading = payload.isLoading
    },
    updateDirection(state, payload) {
        state.direction = payload.direction
    },
    updateData(state, payload) {
        state.data = payload.data
    },
}


export default {
    state,
    getters,
    actions,
    mutations
}